<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>简单个人页面</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="/css/reset.css">
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <link rel="stylesheet" href="../js/plugins/dialog2/dialog.css">
    <script src="../js/plugins/dialog2/dialog.min.js"></script>
    <style>
        .simplePerson {
            text-align: center;
            color: #7A786F;
            padding-top: 50px;
            padding-bottom: 110px;
            background-color: #E8E6E8;
        }

        .mymenu {
            margin: 15px auto;
        }

        .mymenu i {
            margin-right: 20px;
        }

    </style>
    <script>
        $(function () {
            var user = JSON.parse(sessionStorage.getItem("user"));
            $('.simplePerson').renderValues(user, {
                'get_userProfile_href': function (item, value) {
                    $(item).attr("data-href", "/userProfiles.html?userId=" + value);
                }
            });

            $('#logout').click(function () {
                $(document).dialog({
                    type: 'confirm',
                    style: 'IOS',
                    titleText: '退出登陆?',
                    position: 'center',
                    buttons: [
                        {
                            name: '确定',
                            callback: function () {
                                $.ajax({
                                    url: "/sessions",
                                    type: "delete",
                                    success: function (data) {
                                        if (data.success) {
                                            window.location.href = '/login.html';
                                        }
                                    }
                                });
                            }
                        },
                        {
                            name: '取消',
                            callback: function () {

                            }
                        }
                    ]
                });

            });

            $('.mymenu a').click(function () {
                var url = $(this).data("url");
                window.parent.location.href = url;
            });
        });
    </script>

    <!--wym:点击头像进入userProfiles.html页面-->
    <script>
        $(function () {
            //1:头像点击事件
            $(".simplePerson .userProfile").click(function () {
                window.parent.location.href = $(this).data("href");

            });
        })
    </script>
</head>


<body>

<div class="simplePerson">
    <!--wym:点击头像进入userProfiles.html页面-->
    <a render-fun="get_userProfile_href" render-key="id" class="userProfile" href="javascript:;">
        <img class="rounded-circle" width="20%" render-src="headImgUrl">
    </a>
    <p><strong render-html="nickName"></strong></p>
    <p render-html="email"></p>
    <hr>
    <div class="mymenu">
        <i class="fa fa-user fa-2x fa-fw"></i>
        <a href="javascript:;" data-url="/mine/profiles.html">
            我的</a>
    </div>
    <div class="mymenu">
        <i class="fa fa-bell fa-2x fa-fw"></i>
        <a href="javascript:;" data-url="/mine/message/message.html">信息</a>
    </div>
    <div class="mymenu">
        <i class="fa fa-comment fa-2x fa-fw"></i>
        <a href="javascript:;" data-url="/mine/message/messageSysnotice.html">通知</a>
    </div>
    <div class="mymenu">
        <i class="fa fa-cog fa-2x fa-fw"></i>
        <a href="javacript:;" data-url="/mine/info.html">设置</a>
    </div>
    <hr style="margin-top: 50px;">
    <div class="mymenu">
        <i class="fa fa-sign-out fa-2x fa-fw"></i>
        <label id="logout">退出登录</label>
    </div>
</div>


</body>

</html>